package com.yzg.thread;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
 * @author misterWei
 * @create 2020年04月12号:01点59分
 * @mailbox forcontinue@163.com
 */
@Slf4j(topic = "c.guard")
public class ThreadGuard {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
            while (true) {
            }
        }, "t1");
        // thread.setDaemon(true); //开始守护
        thread.start();
        TimeUnit.SECONDS.sleep(1);
        log.debug("主线程结束");
    }
}
